<%-- 
    Document   : add_student_post
    Created on : Nov 24, 2011, 8:18:50 PM
    Author     : THIENSUHACK
--%>



<%@page import="java.util.Calendar"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="GetData.DataWS"%>
<%@page import="dktc_ws.Tintuc" %>
<%@page import="java.sql.Date" %>
<%@page import="GetData.CharsetFilter"%>



<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%
    request.setCharacterEncoding("UTF-8");
    response.setCharacterEncoding("UTF-8");
    response.setContentType("text/html; charset=UTF-8"); 
   // CharsetFilter ab=new CharsetFilter();
    
    Tintuc news = new Tintuc();
    news.setTuade(request.getParameter("tieude"));
    news.setMotangan(request.getParameter("motangan"));
    news.setNoidung(request.getParameter("noidung"));
    news.setMaquantri(1);

    Date todayD=new Date(System.currentTimeMillis()); 
    SimpleDateFormat dayFormat= new SimpleDateFormat("dd/MM/yyyy"); 
    String todayS=dayFormat.format(todayD.getTime());  
    news.setNgaydang(todayS);
   int result=0;
   DataWS a=new DataWS();
   //CharsetFilter cf = new CharsetFilter();
//   news.setTuade(cf.toUTF8(news.getTuade()));
   //news.setMotangan(cf.toUTF8(news.getMotangan()));
  // news.setNoidung(cf.toUTF8(news.getNoidung()));
result = a.themtintuc(news.getTuade(),news.getMotangan(),news.getMaquantri(),news.getNgaydang(), news.getNoidung());
   if(result>0)
             {
       out.print("thanh cong");
        response.sendRedirect("/DKTC/admin/index.jsp?page=list_news");
   }
   else
       out.print("that bai");
           %>
           <div><a href="/DKTC/admin/index.jsp?page=list_news">Xem danh sách tin tức</a><a href="/DKTC/admin/index.jsp?page=add_news">Thêm Tin Mới</a></div>